//
//  UIImage+Extend.m
//  WhatWeather
//
//  Created by byn on 16/3/20.
//  Copyright © 2016年 byn. All rights reserved.
//

#import "UIImage+Extend.h"

@implementation UIImage (Extend)

- (UIImage *)imageWithTintColor : (UIColor *)tintColor; {
    
    UIGraphicsBeginImageContextWithOptions(self.size,NO,0.0f);
    [tintColor setFill];
    CGRect bounds = CGRectMake(0, 0, self.size.width, self.size.height);
    UIRectFill(bounds);
    
    [self drawInRect:bounds blendMode:kCGBlendModeDestinationIn alpha:1.0f];
    
    UIImage *tintedImage = UIGraphicsGetImageFromCurrentImageContext();
    UIGraphicsEndImageContext();
    
    return tintedImage;
}

@end
